home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / hzip.com / HUFFDEC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-08  |  999 b   |  37 lines

  1. /////////////////////////////////////////////////
  2. // Huffman decoder header file huffdec.h 
  3. // Copyright (c) 1991 Azarona Software
  4. // All rights reserved.
  5. /////////////////////////////////////////////////
  6.  
  7. #ifndef H_HUFFDEC
  8. #define H_HUFFDEC
  9.  
  10. #include <stdio.h>
  11.  
  12. struct tree_node {
  13.   int left, right;
  14. };
  15.  
  16. class huff_decoder {
  17. protected:
  18.   int cbyte;                 // Current byte to decode
  19.   int cbit;                  // Current bit of byte
  20.   int num_symbols;           // Number of symbols
  21.   tree_node *tree;           // Where the code tree is
  22.   FILE *fin;                 // The file we're coming from
  23.   long text_locn;            // Start of text in file
  24. public:
  25.   huff_decoder(void) { ; }
  26.   int connect(FILE *f, long locn);
  27.   void reset(void);
  28.   void reset(long locn);
  29.   int get_input_char(void) { return fgetc(fin); }
  30.   int get_bits(int nbits);
  31.   int get_next_char(void);
  32.   void build_tree(long locn);
  33.   long tlocn(void) { return text_locn; }
  34. };
  35.  
  36. #endif
  37.